package edu.gatech.oad.antlab.person;

//import java.util.Scanner; Used in Testing Block

/**
 *  A simple class for person 3
 *  returns their name and a
 *  reversed string 
 *  
 *  @author  Bob
 *  @version 1.1
 */
public class Person3 {
   /** Holds the persons real name */  
	private String name;
	
	/**
	 * The constructor, takes in the persons
	 * name
	 * @param pname the person's real name
	 */
	public Person3(String pname){
	  name = pname;
	}
	
	/**
	 * Return a string rep of this object
	 * that varies with an input string
	 *
	 * @param input the varying string
	 * @return the string representing the 
	 *         object
	 */
	public String toString(String input) {
	  return name + calc(input);
	}
	
	/**
	 * This method should take the string
	 * input and return its reverse.
	 * given "gtg123b" it should return
	 * b321gtg.
	 *
	 * @param input the string to be reversed
	 * @return the reversed string
	 */
	private String calc(String input) {
	  //Person 3 put your implementation here
		String strRev = "";
		int strLength = input.length();
		for (int i = 0; i < strLength; i++) {
			strRev = input.charAt(i) + strRev;
		}
	  return (String) strRev;
	}
	
	/* Testing Block
	public static void main(String[] args)
    {
    	Scanner scan = new Scanner(System.in);
    	System.out.println("Please type something");
    	String junk = scan.nextLine();
    	System.out.println(junk + " -> string rotating now");
    	
    	Person3 p4 = new Person3(junk);
    	System.out.println(p4.calc(junk)); 
    //	System.out.println(p4);
    }
    */
}
